package fr.charlesen.projets.utt.lo09.entites;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Charles EDOU NZE
 */
@Entity
@Table(name = "STAGES", catalog = "", schema = "CHARLES")
@NamedQueries({
    @NamedQuery(name = "Stages.findAll", query = "SELECT s FROM Stages s"),
    @NamedQuery(name = "Stages.findById", query = "SELECT s FROM Stages s WHERE s.id = :id"),
    @NamedQuery(name = "Stages.findByType", query = "SELECT s FROM Stages s WHERE s.type = :type"),
    @NamedQuery(name = "Stages.findBySujet", query = "SELECT s FROM Stages s WHERE s.sujet LIKE :sujet"),
    @NamedQuery(name = "Stages.findByEntreprise", query = "SELECT s FROM Stages s WHERE s.entreprise LIKE :entreprise"),
    @NamedQuery(name = "Stages.findByVille", query = "SELECT s FROM Stages s WHERE s.ville = :ville"),
    @NamedQuery(name = "Stages.findByPays", query = "SELECT s FROM Stages s WHERE s.pays = :pays"),
    @NamedQuery(name = "Stages.findByDateajout", query = "SELECT s FROM Stages s WHERE s.dateajout = :dateajout")})
public class Stages implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "TYPE", nullable = false, length = 4)
    private String type;
    @Basic(optional = false)
    @Column(name = "SUJET", nullable = false, length = 100)
    private String sujet;
    @Basic(optional = false)
    @Column(name = "ENTREPRISE", nullable = false, length = 50)
    private String entreprise;
    @Basic(optional = false)
    @Column(name = "VILLE", nullable = false, length = 50)
    private String ville;
    @Basic(optional = false)
    @Column(name = "PAYS", nullable = false, length = 50)
    private String pays;
    @Column(name = "DATEAJOUT")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateajout;
    @OneToMany(mappedBy = "idStage")
    private Collection<Etudiants> etudiantsCollection;

    public Stages() {
    }

    public Stages(Integer id) {
        this.id = id;
    }

    public Stages(Integer id, String type, String sujet, String entreprise, String ville, String pays) {
        this.id = id;
        this.type = type;
        this.sujet = sujet;
        this.entreprise = entreprise;
        this.ville = ville;
        this.pays = pays;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getSujet() {
        return sujet;
    }

    public void setSujet(String sujet) {
        this.sujet = sujet;
    }

    public String getEntreprise() {
        return entreprise;
    }

    public void setEntreprise(String entreprise) {
        this.entreprise = entreprise;
    }

    public String getVille() {
        return ville;
    }

    public void setVille(String ville) {
        this.ville = ville;
    }

    public String getPays() {
        return pays;
    }

    public void setPays(String pays) {
        this.pays = pays;
    }

    public Date getDateajout() {
        return dateajout;
    }

    public void setDateajout(Date dateajout) {
        this.dateajout = dateajout;
    }

    public Collection<Etudiants> getEtudiantsCollection() {
        return etudiantsCollection;
    }

    public void setEtudiantsCollection(Collection<Etudiants> etudiantsCollection) {
        this.etudiantsCollection = etudiantsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Stages)) {
            return false;
        }
        Stages other = (Stages) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fr.charlesen.projets.utt.lo09.enites.Stages[id=" + id + "]";
    }
}
